using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities.Auditing;

namespace BW.WMS.WareHouseManage
{
    /// <summary>
    /// 库位实体
    /// </summary>
    public class Location : FullAuditedEntity<Guid>
    {
        /// <summary>
        /// 所属库区ID
        /// </summary>
        public Guid ZoneId { get; set; }
        
        /// <summary>
        /// 库位编码
        /// </summary>
        public string Code { get; set; }
        
        /// <summary>
        /// 库位名称
        /// </summary>
        public string Name { get; set; }
        
        /// <summary>
        /// 状态 (0-停用，1-启用)
        /// </summary>
        public int Status { get; set; }
        
        /// <summary>
        /// 库位类型 (1-存储位，2-拣货位，3-暂存位，4-报废位)
        /// </summary>
        public int LocationType { get; set; }
        
        /// <summary>
        /// 容量（体积/m³）
        /// </summary>
        public decimal Capacity { get; set; }
        
        /// <summary>
        /// 负载（重量）
        /// </summary>
        public decimal Load { get; set; }
        
        /// <summary>
        /// 库位主管
        /// </summary>
        public string Manager { get; set; }
        
        /// <summary>
        /// 联系电话
        /// </summary>
        public string ContactPhone { get; set; }
        
        /// <summary>
        /// 库位地址
        /// </summary>
        public string Address { get; set; }
        
        /// <summary>
        /// 排序
        /// </summary>
        public int SortOrder { get; set; }
        
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        
        /// <summary>
        /// 优品仓库编号
        /// </summary>
        public string ExternalCode { get; set; }
        
        /// <summary>
        /// 当前可用容量
        /// </summary>
        public decimal AvailableCapacity { get; set; }
        
        /// <summary>
        /// 当前存储数量
        /// </summary>
        public int CurrentQuantity { get; set; }
        
        /// <summary>
        /// 排号
        /// </summary>
        public string Row { get; set; }
        
        /// <summary>
        /// 列号
        /// </summary>
        public string Column { get; set; }
        
        /// <summary>
        /// 层号
        /// </summary>
        public string Layer { get; set; }
        
        // 导航属性 - 所属库区
        public virtual Zone Zone { get; protected set; }
        
        // 导航属性 - 库位中存储的物品
        public virtual ICollection<LocationItem> LocationItems { get; protected set; }
        
        protected Location()
        {
            LocationItems = new List<LocationItem>();
        }
        
        public Location(
            Guid id,
            Guid zoneId,
            string code,
            string name = null,
            int locationType = 1,
            int status = 1) : base(id)
        {
            ZoneId = zoneId;
            Code = code;
            Name = name ?? code;
            LocationType = locationType;
            Status = status;
            LocationItems = new List<LocationItem>();
        }
    }
} 